﻿/*
 * 
 * Description: Office COMAddins Connector office object library dispatcher
 */
#ifndef OCC_CCOMADDIN_H
#define OCC_CCOMADDIN_H

namespace {
constexpr const DWORD DISPID_CCOMADDIN_GET_APPLICATION = 0x60020000;
constexpr const DWORD DISPID_CCOMADDIN_GET_CREATOR = 0x60020001;
constexpr const DWORD DISPID_CCOMADDIN_DESCRIPTION = 0x0;
constexpr const DWORD DISPID_CCOMADDIN_PROGID = 0x3;
constexpr const DWORD DISPID_CCOMADDIN_GUID = 0x4;
constexpr const DWORD DISPID_CCOMADDIN_CONNECT = 0x6;
constexpr const DWORD DISPID_CCOMADDIN_OBJECT = 0x7;
constexpr const DWORD DISPID_CCOMADDIN_PARENT = 0x8;
}

class CCOMAddIn : public COleDispatchDriver {
public:
    CCOMAddIn() {}
    CCOMAddIn(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
    CCOMAddIn(const CCOMAddIn &dispatchSrc) : COleDispatchDriver(dispatchSrc) {}

    LPDISPATCH get_Application()
    {
        LPDISPATCH result;
        InvokeHelper(DISPID_CCOMADDIN_GET_APPLICATION, DISPATCH_PROPERTYGET, VT_DISPATCH, (void *)&result, nullptr);
        return result;
    }
    long get_Creator()
    {
        long result;
        InvokeHelper(DISPID_CCOMADDIN_GET_CREATOR, DISPATCH_PROPERTYGET, VT_I4, (void *)&result, nullptr);
        return result;
    }
    CString get_Description()
    {
        CString result;
        InvokeHelper(DISPID_CCOMADDIN_DESCRIPTION, DISPATCH_PROPERTYGET, VT_BSTR, (void *)&result, nullptr);
        return result;
    }
    void put_Description(LPCTSTR newValue)
    {
        static BYTE parms[] = VTS_BSTR;
        InvokeHelper(DISPID_CCOMADDIN_DESCRIPTION, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, newValue);
    }
    CString get_ProgId()
    {
        CString result;
        InvokeHelper(DISPID_CCOMADDIN_PROGID, DISPATCH_PROPERTYGET, VT_BSTR, (void *)&result, nullptr);
        return result;
    }
    CString get_Guid()
    {
        CString result;
        InvokeHelper(DISPID_CCOMADDIN_GUID, DISPATCH_PROPERTYGET, VT_BSTR, (void *)&result, nullptr);
        return result;
    }
    BOOL get_Connect()
    {
        BOOL result;
        InvokeHelper(DISPID_CCOMADDIN_CONNECT, DISPATCH_PROPERTYGET, VT_BOOL, (void *)&result, nullptr);
        return result;
    }
    void put_Connect(BOOL newValue)
    {
        static BYTE parms[] = VTS_BOOL;
        InvokeHelper(DISPID_CCOMADDIN_CONNECT, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, newValue);
    }
    LPDISPATCH get_Object()
    {
        LPDISPATCH result;
        InvokeHelper(DISPID_CCOMADDIN_OBJECT, DISPATCH_PROPERTYGET, VT_DISPATCH, (void *)&result, nullptr);
        return result;
    }
    void put_Object(LPDISPATCH newValue)
    {
        static BYTE parms[] = VTS_DISPATCH;
        InvokeHelper(DISPID_CCOMADDIN_OBJECT, DISPATCH_PROPERTYPUT, VT_EMPTY, nullptr, parms, newValue);
    }
    LPDISPATCH get_Parent()
    {
        LPDISPATCH result;
        InvokeHelper(DISPID_CCOMADDIN_PARENT, DISPATCH_PROPERTYGET, VT_DISPATCH, (void *)&result, nullptr);
        return result;
    }
};

#endif  // !OCC_CCOMADDIN_H